import django
django.setup()

from elasticsearch import Elasticsearch
from house.models import House


es = Elasticsearch("http://8.154.26.188:9200")

house=House.objects.all()
for i in house:
    es.index(index="beike",body={
                'id': i.id,
                'title': i.title,
                'type': 'house'
             })
dsl={
    "query": {
        "match_all": {}
    }
}


res=es.search(index="beike",body=dsl)
print(res['hits']['hits'])